#include <CGAL/Cartesian.h>
#include <cassert>
//using namespace CGAL;
typedef CGAL::Cartesian<double> K;
typedef K::Point_2 Point_2;
typedef K::Segment_2 Segment_2;

void test_001();
void test_intersection();

int main()
{
	test_001();
	test_intersection();
}

void test_001()
{
	CGAL::Cartesian<double>::Point_2 p(1.0, 1.0), q;
	CGAL::Cartesian<double>::Vector_2 v;
	v = p - CGAL::ORIGIN;
	q = CGAL::ORIGIN + v;
	assert(p == q);
}

void test_intersection()
{
	Segment_2 segment_1, segment_2;
	std::cin >> segment_1 >> segment_2;

	/* C++11 */
	auto v = intersection(segment_1, segment_2);
	/* C++03 */
	//cpp11::result_of<K::Intersect_2(Segment_2, Segment_2)>::type
	//	v = intersection(segment_1, segment_2);
	if (v) {
		/* not empty */
		if (const Point_2 *p = boost::get<Point_2>(&*v)) {
			/* do something with *p */
		}
		else {
			const Segment_2 *s = boost::get<Segment_2>(&*v);
			/* do something with *s */
		}
	}
	else {
		/* empty intersection */
	}
}